const db = require('../db');

module.exports = {
	AddTask: async (task_name) => {
		const date = new Date();
		let task_time = date.toLocaleDateString(); //获取当前日期
		const sql = 'insert into tasks_tb (task_name,task_status,task_time,task_priority) values(?,?,?,?)';
		return await db.query(sql, [task_name, 0, task_time, 0]);
	},
	GetAddedTasks: async () => {
		const sql = 'select * from tasks_tb where task_status = 0';
		return await db.query(sql, []);
	},
	GetFinisedTasks: async () => {
		const sql = 'select * from tasks_tb where task_status = 1';
		return await db.query(sql, []);
	},
};
